package cn.lingnan.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("admin/consumer")
public class AdminController {
    @Autowired
    private RestTemplate restTemplate;

    private String url_prefix = "http://provider-admin";


    @GetMapping("toLogin")
    public String toLogin(){
        return "login";
    }

    @PostMapping("login")
    public String login(String account, String password, Model model, HttpSession session) {

        if(account.equals("feilong")&&password.equals("shop")){
            return "frame";
        }
        model.addAttribute("msg","账号或密码错误");
        return "login";
    }


}
